package model.components.nodes.node;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public class Node
{
	public static final String GREY_ROUTER = "/icons/greyRouter.png";
	public static final String GREEN_ROUTER = "/icons/greenRouter.png"; 
	public static final String YELLOW_ROUTER = "/icons/yellowRouter.png"; 
	public static final String RED_ROUTER = "/icons/redRouter.png";
	
	public static final String GREY_SWITCH = "/icons/greySwitch.png";
	public static final String GREEN_SWITCH = "/icons/greenSwitch.png"; 
	public static final String YELLOW_SWITCH = "/icons/yellowSwitch.png"; 
	public static final String RED_SWITCH = "/icons/redSwitch.png";
	
	public static final String GREY_PHYSICAL_SERVER = "/icons/greyPhysicalServer.png";
	public static final String GREEN_PHYSICAL_SERVER = "/icons/greenPhysicalServer.png"; 
	public static final String YELLOW_PHYSICAL_SERVER = "/icons/yellowPhysicalServer.png"; 
	public static final String RED_PHYSICAL_SERVER = "/icons/redPhysicalServer.png";
	
	public static final String ROUTER_TYPE = "Router";
	public static final String SWITCH_TYPE = "Switch";
	public static final String SERVER_TYPE = "Server";
	
	public static final String LINUX_OS = "Linux";
	public static final String WINDOWS_OS = "Windows";
	public static final String SOLARIS_OS = "Solaris";
	public static final String ANDROID_OS = "Android";
	
	public static final String VMWARE_VE = "VMWare";
	public static final String XEN_VE = "Xen";
	public static final String KVM_VE = "KVM";
	public static final String UML_VE = "UML";
	
	private String networkName;
	public String getNetworkName(){ return networkName; }
	public void setNetworkName( String networkName ){ this.networkName = networkName; }
	
	private String namePrefix;
	public String getNamePrefix(){ return namePrefix; }
	public void setNamePrefix( String namePrefix ){ this.namePrefix = namePrefix; }
	
	private String name;
	public String getName(){ return name; }
	public void setName( String name ){ this.name = name; }
	
	private int initialNumber;
	public int getInitialNumber(){ return initialNumber; }
	public void setInitialNumber( int initialNumber ){ this.initialNumber = initialNumber; }
	
	private int number;
	public int getNumber(){ return number; }
	public void setNumber( int number )
	{
		this.number = number;
		this.setName( this.getNamePrefix() + number );
	}
	
	private int timeStamp;
	public int getTimeStamp(){ return timeStamp; }
	public void setTimeStamp( int timeStamp ){ this.timeStamp = timeStamp; }
	
	private String type;
	public String getType(){ return type; }
	public void setType( String type ){ this.type = type; }
	
	private String operatingSystem;
	public String getOperatingSystem(){ return operatingSystem; }
	public void setOperatingSystem( String operatingSystem ){ this.operatingSystem = operatingSystem; }
	
	private String virtualEnvironment;
	public String getVirtualEnvironment(){ return virtualEnvironment; }
	public void setVirtualEnvironment( String virtualEnvironment ){ this.virtualEnvironment = virtualEnvironment; }
	
	private int cpu;
	public int getCpu(){ return cpu; }
	public void setCpu( int cpu ){ this.cpu = cpu; }
		
	private int memory;
	public int getMemory(){ return memory; }
	public void setMemory( int memory ){ this.memory = memory; }
	
	protected int diskSpace;
	public int getDiskSpace(){ return 0; }
	public void setDiskSpace( int diskSpace ){ }
	
	private boolean selected;
	public boolean isSelected(){ return selected; }
	public void setSelected( boolean selected ){ this.selected = selected; }
	
	private Icon greyIcon;
	public Icon getGreyIcon(){ return greyIcon; }
	public void setGreyIcon( Icon greyIcon ){ this.greyIcon = greyIcon; }
	
	private Icon greenIcon;
	public Icon getGreenIcon(){ return greenIcon; }
	public void setGreenIcon( Icon greenIcon ){ this.greenIcon = greenIcon; }
	
	private Icon yellowIcon;
	public Icon getYellowIcon(){ return yellowIcon; }
	public void setYellowIcon( Icon yellowIcon ){ this.yellowIcon = yellowIcon; }
	
	private Icon redIcon;
	public Icon getRedIcon(){ return redIcon; }
	public void setRedIcon( Icon redIcon ){ this.redIcon = redIcon; }
	
	public Node( String networkName, String namePrefix, int number, String type, String operatingSystem, String virtualEnvironment, int cpu, int memory, String greyIcon, String greenIcon, String yellowIcon, String redIcon )
	{
		this.setNetworkName( networkName );
		this.setNamePrefix( namePrefix );
		this.setNumber( number );
		this.setType( type );
		this.setOperatingSystem( operatingSystem );
		this.setVirtualEnvironment( virtualEnvironment );
		this.setCpu( cpu );
		this.setMemory( memory );
		this.setSelected( false );
		this.setGreyIcon( new ImageIcon( this.getClass().getResource( greyIcon ) ) );
		this.setGreenIcon( new ImageIcon( this.getClass().getResource( greenIcon ) ) );
		this.setYellowIcon( new ImageIcon( this.getClass().getResource( yellowIcon ) ) );
		this.setRedIcon( new ImageIcon( this.getClass().getResource( redIcon ) ) );
	}
	
	public Node getCopy()
	{
		return null;
	}
	
	@Override
	public String toString()
	{
		return Integer.toString( this.getNumber() );
	}
	
}
